{extend name="common/menu_child" /}

{block name="nav"}
<span class="layui-breadcrumb">
	<a>资源回收</a>
	<a><cite>可用地区</cite></a>
</span>
{/block}

{block name="body"}
<div class="layui-row">
	<form class="layui-form layui-col-md12 x-so">
		<input class="layui-input" style="width:200px;" placeholder="标题" name="title" value="{$condition.title}" />
		<div class="layui-input-inline">
			<select name="is_recovery">
				<option value="">是否允许</option>
				{foreach name="is_recovery" item="vo" key="ko"}
				<option value="{$ko}" {heq name="condition.is_recovery" value="$ko"}selected{/heq}>{$vo}</option>
				{/foreach}
			</select>
		</div>
		<input style="display:none;" name="p" value="1" />
		<button class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
	</form>
</div>
<table class="layui-table">
	<thead>
		<tr>
			<th>序号</th>
			<th>地址名称</th>
			<th>订单数量</th>
			<th>是否允许</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		{eq name="data_list|count" value="0"}
			<tr>
				<td colspan="20">暂无数据</td>
			</tr>
		{else/}
			{foreach name="data_list" item="vo" key="ko"}
			<tr>
				<td>{$ko + 1}</td>
				<td>{$vo.name_full}</td>
				<td>{$vo.order_number}</td>
				<td>{$vo.is_recovery_string}&nbsp;<a style="color:#778899;" href="javascript:change_recovery({$vo.id}, {$vo.is_recovery});" >[更改]</a></td>
				<td class="td-manage"></td>
			</tr>
			{/foreach}
		{/eq}
	</tbody>
</table>

<div class="page">{$page}</div>
{/block}

{block name="javascript"}
<script type="text/javascript">
	
	/**
	 * 更改状态
	 */
	function change_recovery(id, status) {
		layer.confirm('确定要更改吗', {}, function(){
			let url = '{:url("change_recovery")}';
			let data = {id: id, status, status};
			action_post_json(url, data, function(response){
				layer.msg(response.message);
				if(0 === response.errno){
					setTimeout(function(){
						window.location.reload();
					}, 1000);
				};
			});
		});
	};
	
</script>
{/block}